package com.itheima.web.controller;

import com.itheima.web.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService userService;

    /**
     * 查询用户列表
     * @param pageNumber
     * @param pageSize
     * @return
     */
    @GetMapping("/findByPage")
    public ResponseEntity findByPage(@RequestParam(defaultValue = "1")Integer pageNumber,
                                     @RequestParam(defaultValue = "10")Integer pageSize){
        return userService.findByPage(pageNumber,pageSize);
    }
}
